<template>
  <div class="tjc">
    <div class="head">
      <div class="tit">告警事件统计</div>
      <div class="opt">
        <el-select v-model="state.pm.type" @change="getData">
          <el-option label="当日" value="everyday" />
          <el-option label="近7日" value="7" />
          <el-option label="近15日" value="15" />
          <el-option label="近30日" value="30" />
        </el-select>
      </div>
    </div>
    <div class="ec">
      <div class="card">
        <div class="yuan">{{state.data.alarmCount||0}}</div>
        <div class="ytit">全部事件数量</div>
      </div>
      <div class="card">
        <div class="yuan" style="background-image: url('/images/bj2.png');">{{state.data.alarmDealCount||0}}</div>
        <div class="ytit">已办结事件数量</div>
      </div>
      <div class="card">
        <div class="yuan" style="background-image: url('/images/bj3.png');">{{state.data.alarmUnDealCount||0}}</div>
        <div class="ytit">未办结事件数量</div>
      </div>
    </div>
  </div>
</template>

<script setup>
const props = defineProps({
  vid: String
});
const state = reactive({
  pm: { type: 'everyday' },
  data: {},
  myChart: null,
})
watch(() => props.vid,
  (newval) => {
    getData();
  }
);
const getData = () => {
  useApi.post("/arhome/dashboard/stat/alarmcount", { dimension: state.pm.type }).then((res) => {
    state.data = res.data
  });
}

onMounted(() => {
  getData()
})
</script>

<style lang="scss" scoped>
.tjc {
  width: 380px;
  height: 282px;
  background-image: url('/images/bgtj.png');
  background-size: 100% 100%;
  background-repeat: no-repeat;
  padding: 10px;
}

.head {
  display: flex;
  height: 30px;
  margin-top: 10px;
  border-bottom: 1px solid #5FB1E8;

  .tit {
    margin-left: 100px;
    width: 180px;
    display: flex;
    justify-content: center;
    font-weight: 500;
    font-size: 16px;
    color: #FFFFFF;
    line-height: 22px;
  }

  .opt {
    width: 100px;
    text-align: right;
  }
}

.ec {
  margin-top: 2px;
  height: 215px;
  display: flex;
  justify-content: space-around;
  align-items: center;

  .card {
    width: 90px;
    display: flex;
    flex-direction: column;
    font-weight: 500;
    color: #FFFFFF;

    .yuan {
      width: 90px;
      height: 90px;
      display: flex;
      justify-content: center;
      align-items: center;
      background-image: url('/images/bj1.png');
      background-size: 100% 100%;
      background-repeat: no-repeat;
      font-size: 22px;
    }

    .ytit {
      width: 90px;
      padding: 0 15px;
      flex-wrap: wrap;
      font-size: 14px;
      text-align: center;
    }
  }
}

:deep(.el-select) {
  width: 80px;
  margin-top: -4px;
  --el-input-text-color: #ffffff;
  --el-select-input-color: #ffffff;

  .el-select__wrapper {
    background: transparent;
    color: #FFFFFF;
    border: none;
    box-shadow: none;
    border-radius: 0px !important;
  }
}
</style>